<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="author" content="tis-tis" />
<link href="{$tpl_path}/adminstyle.css" type=text/css rel=stylesheet />
<title>{$title}</title>
</head>
<script language="javascript">var img_cat = '{$img_cat}';</script>
{literal}
<script language="javascript" src="js/jquery.js"></script>
<script language="javascript">
function setAdd(obj, url) {
	$.post("image_admin.php?act=isAd", {value: url}, function(data){ 
		
        if(data.result == 'delete'){ 
        	obj.src = 'images/no.gif';
        }else{ 
        	obj.src = 'images/yes.gif';
        } 
		}, "json");
}

/**
 * 对广告位的图片进行处理，如果不是广告位则不能编辑！
 */
function editImage(img_url) {
$.post("image_admin.php?act=canEdit", {value : img_url}, function(data){
        if(data.canDo){ 
            alert('yes');
        }else{ 
        	alert('对不起，操作被禁止，因为该图片不是广告位！');
        } 
		}, "json");
}
</script>
{/literal}
<body>
<!-- 头部 -->
<div class="adminbox">{include file="header.tpl"} <!-- 左边工具条-->
<div class="mainbox">{include file="sidebar.tpl"} <!-- 右边内容部分，即可变部分 -->
<div class="contentbox">
<div>
<table class="table_border" width="859px" cellspacing="0"
	cellpadding="0">
	<tr>
		<th>图片地址</th>
		<th>广告位</th>
		<th>操作</th>
	</tr>
	{foreach from=$img_infos item=img_info}
	<tr align="center">
		<td align="center" valign="top">{$img_info.img_url}</td>
		<td align="center"><img
			src="images/{if $img_info.ad}yes{else}no{/if}.gif"
			onclick="javascript:setAdd(this, '{$img_info.img_url}');" /></td>

		<td width="24%" align="center" valign="top"><a
			href="javascript:editImage('{$img_info.img_url}')" title="删除该分类">编辑</a>
		| <a
			href="image_admin.php?act=delete&amp;value={$img_info.img_url}{if $img_cat}&img_cat={$img_cat}{/if}"
			title="删除该图片">删除</a></td>
	</tr>
	{/foreach}
</table>
<div class="height_5"></div>
<div align="center"><a href='image_admin.php?act=insert'>上传图片</a></div>
</div>
</div>
</div>
</div>

</body>
</html>
